var http = require('http');
var express = require('express');
var path = require('path');

var app = express();

app.use(express.static(path.resolve(__dirname, "public")));

app.set("views", path.resolve(__dirname, "views"));
app.set("view engine", "ejs");
var port = 18080;

app.get("/", function (req, res) {
    res.render("index");
});
app.listen(8080);
// http.createServer(function(req, res) {
//     res.writeHead(200, {'Content-Type': 'text/html'});
//     var body = ' \
//         <html> \
//             <head> \
//                 <meta charset="utf-8"> \
//                 <title>Welcome to BAE</title> \
//             </head> \
//             <body> \
//                 <h4>Welcome to Baidu App Engine!</h4> \
//                 <h2>欢迎开启BAE之旅！</h2> \
//                 <br> \
//                 <br> \
//                 <ul>以下链接可能对您有用：</ul> \
//                 <ul><a href="https://bce.baidu.com/doc/BAE/QuickGuide.html" target="_blank">入门指南</a></ul> \
//                 <ul><a href="http://developer.baidu.com/forum/topic/list?boardId=66" target="_blank">论坛</a></ul> \
//                 <ul><a href="http://www.baeblog.com/" target="_blank">技术博客</a></ul> \
//                 <ul><a href="http://weibo.com/baiduappengine" target="_blank">微博</a></ul> \
//                 <ul><a href="https://bce.baidu.com/doc/BAE/FAQ.html" target="_blank">常见问题</a></ul> \
//             </body> \
//         </html> \
//     ';
//     res.write(body);
//     res.end();
// }).listen(port);
